package org.the.gsdo.server;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Lazy(true)
@Scope("request")
@Profile( { "prod", "dev" } )
public class HttpDataProviderImpl implements HttpDataProvider {

	private final HttpServletRequest request;

	@Autowired
	public HttpDataProviderImpl(HttpServletRequest request) {
		this.request = request;
	}

	@Override
	public String getUserAgent() {
		return request.getHeader("User-Agent");
	}

	@Override
	public String getServerInfo() {
		return request.getSession().getServletContext().getServerInfo();
	}

}
